#include <unistd.h>
#include "stdio.h"
#include "iostream"
#include <fstream>
#include "MyMqttClient.h"

void on_connect(void*myclient,MyMqttClientMessage*message,MyMqttClientEvent event)
{
	MyMqttClient *m = (MyMqttClient*)myclient;
    printf("on_connect..\r\n");
}

void on_recv(void*myclient,MyMqttClientMessage*message,MyMqttClientEvent event)
{
	printf("on_recv:message=  %s\r\n",(char*)m->message.payload);
}
int main(int argc, char* argv[])
{

	MyMqttClient mq ;
	mq.on_connect = on_connect;
	mq.on_recv = on_recv;
	mq.init_params(0x01608B0240,(char*)"e567b535",(char*)"tcp://58.42.237.171:1883");
	if(mq.connect()>=0){
		while(1)
		{
			mq.poll();
			usleep(10000);
		}
	}
	return 0;
}
